CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

SET(NAME Engine)
PROJECT(${NAME})

file(GLOB TOTEM_HEADER ${CMAKE_SOURCE_DIR}/Include/Totem/*.h)
SOURCE_GROUP("Source Files\\Include\\Totem" FILES ${TOTEM_HEADER})

file(GLOB_RECURSE HEADER_FILES *.h)
file(GLOB_RECURSE SOURCE_FILES *.cpp)
SOURCE_GROUP("Source Files" FILES ${HEADER_FILES} ${SOURCE_FILES})

FIND_PACKAGE(ClanLib REQUIRED)
file(GLOB CL_HEADER ${CL_DIR}/*.h)
SOURCE_GROUP("Source Files\\Include\\ClanLib" FILES ${CL_HEADER})

ADD_LIBRARY(${NAME}
	${HEADER_FILES} ${SOURCE_FILES}
	${TOTEM_HEADER}
	${CL_HEADER}
)

set_target_properties(${NAME} PROPERTIES FOLDER "Sources")

if (MSVC)
   set_target_properties(${NAME} PROPERTIES COMPILE_FLAGS "/Yuprecomp.h")
   set_source_files_properties(precomp.cpp PROPERTIES COMPILE_FLAGS "/Ycprecomp.h")
endif(MSVC)

TARGET_LINK_LIBRARIES(${NAME} 
	debug ${CL_CORE_LIBRARY_DEBUG} 	 	optimized ${CL_CORE_LIBRARY_RELEASE}
	debug ${CL_DB_LIBRARY_DEBUG} 	 	optimized ${CL_DB_LIBRARY_RELEASE}
	debug ${CL_DISPLAY_LIBRARY_DEBUG} 	optimized ${CL_DISPLAY_LIBRARY_RELEASE}
	#debug ${CL_GL_LIBRARY_DEBUG}	 	optimized ${CL_GL_LIBRARY_RELEASE}
	debug ${CL_D3D_LIBRARY_DEBUG}	 	optimized ${CL_D3D_LIBRARY_RELEASE}
	debug ${CL_NET_LIBRARY_DEBUG} 	 	optimized ${CL_NET_LIBRARY_RELEASE}
	debug ${CL_SQ_LIBRARY_DEBUG} 	 	optimized ${CL_SQ_LIBRARY_RELEASE}
	debug ${CL_SOUND_LIBRARY_DEBUG} 	optimized ${CL_SOUND_LIBRARY_RELEASE}
	debug ${CL_GUI_LIBRARY_DEBUG} 		optimized ${CL_GUI_LIBRARY_RELEASE}
	debug ${CL_CSS_LIBRARY_DEBUG} 		optimized ${CL_CSS_LIBRARY_RELEASE}
	debug ${CL_SCENE3D_LIBRARY_DEBUG}	optimized ${CL_SCENE3D_LIBRARY_RELEASE}
)

INCLUDE_DIRECTORIES(
	${CL_INCLUDE}
)
